/* 工作流执行监控样式 */
.workflow-execution-monitor {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  max-height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid #e8e8e8;
  z-index: 1000;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* 监控头部 */
.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.monitor-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.workflow-id {
  font-size: 11px;
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.control-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.2s ease;
}

.control-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 监控内容 */
.monitor-content {
  max-height: 520px;
  overflow-y: auto;
  padding: 16px;
}

/* 指标部分 */
.metrics-section {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.metric-item {
  flex: 1;
  text-align: center;
}

.metric-label {
  display: block;
  font-size: 11px;
  color: #6c757d;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.metric-value {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
}

/* 节点部分 */
.nodes-section {
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.section-header h5 {
  margin: 0;
  font-size: 13px;
  color: #495057;
  font-weight: 600;
}

.node-count {
  font-size: 11px;
  color: #6c757d;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
}

.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.node-status-card {
  padding: 8px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: white;
  transition: all 0.2s ease;
}

.node-status-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.node-status-card.running {
  border-color: #1890ff;
  background: #f0f8ff;
}

.node-status-card.completed {
  border-color: #52c41a;
  background: #f6ffed;
}

.node-status-card.failed {
  border-color: #ff4d4f;
  background: #fff2f0;
}

.node-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.node-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.node-name {
  font-size: 12px;
  font-weight: 500;
  color: #495057;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.node-status-text {
  font-size: 10px;
  color: #6c757d;
  text-transform: capitalize;
}

.node-progress {
  width: 40px;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #1890ff;
  transition: width 0.3s ease;
}

.node-error {
  font-size: 10px;
  color: #dc3545;
  margin-top: 4px;
  padding: 2px 4px;
  background: #f8d7da;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 日志部分 */
.logs-section {
  margin-bottom: 0;
}

.log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-scroll-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6c757d;
  cursor: pointer;
}

.auto-scroll-toggle input {
  margin: 0;
}

.clear-logs-button {
  background: none;
  border: 1px solid #dee2e6;
  color: #6c757d;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-logs-button:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
}

.logs-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #f8f9fa;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.log-entry {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.4;
  border-bottom: 1px solid #e9ecef;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry.info {
  background: white;
  color: #495057;
}

.log-entry.warning {
  background: #fff3cd;
  color: #856404;
}

.log-entry.error {
  background: #f8d7da;
  color: #721c24;
}

.log-entry.success {
  background: #d4edda;
  color: #155724;
}

.log-timestamp {
  color: #6c757d;
  white-space: nowrap;
  font-size: 10px;
}

.log-node-id {
  color: #007bff;
  font-weight: 500;
  white-space: nowrap;
}

.log-message {
  flex: 1;
  word-break: break-word;
}

.no-logs {
  padding: 20px;
  text-align: center;
  color: #6c757d;
  font-size: 12px;
  font-style: italic;
}

/* 滚动条样式 */
.monitor-content::-webkit-scrollbar,
.logs-container::-webkit-scrollbar {
  width: 6px;
}

.monitor-content::-webkit-scrollbar-track,
.logs-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.monitor-content::-webkit-scrollbar-thumb,
.logs-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.monitor-content::-webkit-scrollbar-thumb:hover,
.logs-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .workflow-execution-monitor {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 50vh;
    border-radius: 12px 12px 0 0;
  }

  .nodes-grid {
    grid-template-columns: 1fr;
  }

  .metrics-section {
    flex-direction: column;
    gap: 8px;
  }

  .metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .metric-label {
    margin-bottom: 0;
  }
}

/* 动画效果 */
.workflow-execution-monitor {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 状态指示器动画 */
.node-status-card.running .node-status-dot {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* 进度条动画 */
.progress-bar {
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
